/****************************************************************
 *
 * MODULE NAME:    obex_tal.h
 * PROJECT CODE:   Bluetooth host
 * DESCRIPTION:    transport abstraction layer
 * MAINTAINER:     Mark Donnelly, kevin Traynor
 *
 * SOURCE CONTROL: $Id: obex_tal.h,v 1.2 2009/08/25 05:54:13 jianguo Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001 RDA Microelectronics
 *     All rights reserved.
 *
 * REVISION HISTORY:
 * 
 *
 * ISSUES:
 * 
 ***********************************************************************/
#ifndef  __OBEX_TAL_H__
#define  __OBEX_TAL_H__

struct rdabt_obex_transport{
  u_int32 tid;
  u_int16 max_transport;
  u_int16 max_obex;
  u_int16 length;
  u_int8* rx_buffer;
  u_int8 type;
  t_pEvent connect_wait;
  union {
    struct {
      t_bdaddr address;
      u_int8 server_channel;
      u_int8 flow_state;
      u_int8 dlci;
      void (*disconnect)(u_int32 tid);
    }rfcomm;
    struct {
      u_int32 port;
    }serial;
    struct {
      u_int32 socket;
    }socket;
    struct {
      char* url;
    }gen;
  }use;
  struct rdabt_obex_transport* p_next;
  u_int8 flow_lock  ;
u_int8 flow;
 struct rdabt_obex_retransmit_info *pInfo;
};

 #define MAX_OBEX_FLOW 2
 struct rdabt_obex_transport_flow
 {
// t_bdaddr address;
u_int32 tid;
u_int8 rdabt_obex_flow_lock  ;
u_int8 rdabt_obex_flow;
 struct rdabt_obex_retransmit_info* pInfo;

 };



/*int OBEX_TransportListen_Serial(port);
  int OBEX_TransportListen_Socket(port);*/

int rdabt_obex_transport_tx(u_int32 tid, t_DataBuf* txbuffer);
u_int32 rdabt_obex_allocate_tid(void);
void rdabt_obex_clean_tid(void);

t_api rdabt_obex_tal_rfcomm_reg_port(u_int8 server_channel,u_int16 max_obex,u_int8* rx_buffer);


t_api rdabt_obex_tal_rfcomm_connect_port(t_bdaddr bdaddr, u_int8 schan, u_int16 mtu);
//int rdabt_obex_create_client_callback(u_int32 tid, t_obex_command_handler handler);
void rdabt_obex_tal_remove_transport(struct rdabt_obex_transport* target);

t_api rdabt_obex_tal_rfcomm_connect_conf(rdabt_t_rfcomm_schan schan, t_bdaddr addr, u_int8 status, rdabt_t_rfcomm_dlci dlci, u_int16 frame_size);


t_api rdabt_obex_tal_rfcomm_connect_ind(rdabt_t_rfcomm_schan schan, t_bdaddr addr, rdabt_t_rfcomm_dlci dlci, u_int16 frame_size);
t_api rdabt_obex_tal_rfcomm_client_data(t_bdaddr addr,rdabt_t_rfcomm_dlci dlci, rdabt_host_buf_t *p_buf);

t_api rdabt_obex_tal_rfcomm_flow_info_ind( t_bdaddr addr,rdabt_t_rfcomm_dlci dlci, u_int8 flow_state);

t_api rdabt_obex_tal_rfcomm_disconnect_ind(t_bdaddr addr,rdabt_t_rfcomm_dlci dlci);

#endif  /*__OBEX_TAL_H__*/
